/**
 * Environment Definition
 */
jsx3.lang.Package.definePackage("tibco.admin.enterpriseAssets.envDef", function (envDef) {
});

/**
 * envDef
 */
jsx3.lang.Class.defineClass("tibco.admin.enterpriseAssets.envDef.EnvDefPlugin",
        jsx3.lang.Object,
        [tibco.admin.enterpriseAssets.EnterpriseAssetsTabInterface],
        function (plugin) {
            plugin.instance = null

            plugin.prototype.getNamespace = function() {
                return "tibco.admin";
            }

            plugin.prototype.destroyPlugin = function() {
            }

            plugin.prototype.initPlugin = function() {
            }

            plugin.getInstance = function(args) {
                if(!this.instance) {
                    this.instance = new tibco.admin.enterpriseAssets.envDef.EnvDefPlugin();
                }
                return this.instance;
            }

            plugin.prototype.getComponentPath = function() {
                return  "tibco/admin/enterpriseAssets/envDef/component.xml"
            }

            plugin.prototype.loadComponent = function(parent) {
                var me = this;
                tibco.admin.Main.loadUIResourceAsync(parent, this.getNamespace(), "tibco/admin/enterpriseAssets/envDef/components/envDef.xml", me, me.componentLoaded);
            }

            plugin.prototype.componentLoaded = function(objEvent) {
                if(objEvent.status == "SUCCESS") {
                    this.envDef = objEvent.obj;
                    var me = this;
                    this.envDef.handler = me;
                }
            }

            plugin.prototype.getTabText = function() {
                return tibco.admin.Main.getServer().getDynamicProperty("@@EnvironmentDefinition_20")

            }

            plugin.prototype.tabSelected = function() {
                if(this.envDef) {
                    this.envDef.refresh();
                }
            }

            plugin.prototype.allowComponentUnload = function(target, fctnYes, fctnNo, args) {
                if(this.envDef) {
                    this.envDef.allowComponentUnload(target, fctnYes, fctnNo, args);
                }
                else {
                    fctnYes.call(target, args);
                }
            };

            plugin.prototype.unload = function() {
                if(this.envDef) {
                    this.envDef.unload();
                }
            }
        });
